
import javax.swing.*;
import java.util.regex.*;

public class Combinatie extends Responsabil{
    private JFrame f;
    Combinatie(JFrame f){
        this.f = f;
    }
    public boolean test(String s){
        boolean rez = false;
        Pattern p = Pattern.compile("^0*1*2*3*4*5*6*7*8*9*A*B*E*F*G*H*J*K*N*O*P*Q*R*S*T*U*W*Y*Z*0*1*2*3*4*5*6*7*8*9*$");
        Matcher m = p.matcher(s);
        rez = m.matches();
        if(rez == true)
            mesaj(f);
        else{
            if(this.next != null)
                next.test(s);
        }
        return rez;
    }
    public void mesaj(JFrame f){
      JOptionPane.showMessageDialog(f, "Ati introdus un cuvant care contine cifre arabe si caractere invalide", "Eroare", JOptionPane.ERROR_MESSAGE);
      System.exit(1);
    }

}